package handle.query;

import common.Constants.ServiceConstant;
import common.Result;
import dataBean.ScoresDo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import service.QueryService;
import service.VerifyService;

/**
 * Created by lxl on 2015/11/6.
 */
@Controller
@RequestMapping("ssms/query")
public class QueryScoreHandle {

    @Autowired
    private QueryService queryService ;

    @Autowired
    private VerifyService verifyService ;


    @RequestMapping(value = "/score",method = RequestMethod.POST)
    public @ResponseBody
    Result process(@RequestBody ScoresDo scoresDo , @RequestHeader String token ){

        Result result = verifyService.verify(token, ServiceConstant.TEACHER_LEVEL) ;

        if( result.isSucces() ){

            result = queryService.queryScore(0,0,scoresDo) ;

        }

        return result ;
    }

}
